package com.topnav.mc.zzd.account;

import com.topnav.mc.admin.security.PermissionGrade;
import com.topnav.mc.exception.ExceptionMsg;
import com.topnav.mc.uitls.ExceptionUtil;
import com.topnav.mc.uitls.PermissionGradeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: kenny
 * @Date: 2024/3/2 16:58
 */
@Component
public class ZzdAccountUntil {
    @Autowired
    PermissionGradeUtil permissionGradeUtil;

    public ZzdAccount getZzdAccount(){
        PermissionGrade permissionGrade = permissionGradeUtil.getPmGradeCheck();
        if (permissionGrade.getD3PartAcount() == null){
            //没有设置集群对讲的登录帐号
            throw ExceptionUtil.commonException(ExceptionMsg.ERROR_LINK_D3PART_NONE_ACCOUT);
        }
        return new ZzdAccount(permissionGrade.getD3PartAcount().get("account"),permissionGrade.getD3PartAcount().get("password"));
    }

}
